import request from '../utils/Request';

export const blogList = (params = {}) => {
  return request({
    url: '/blog/docs',
    method: 'get',
    params,
  });
};

export const getBlogContent = path => {
  return request({
    url: '/blog/content',
    method: 'get',
    params: { path },
  });
};

export const updateBlogContent = data => {
  return request({
    url: '/blog/update',
    method: 'post',
    data,
  });
};

export const uploadImage = file => {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: '/home-page/upload',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data' },
  });
};
